/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package pneuservis.backend.entities;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import pneuservis.backend.others.OrderStatus;

/**
 *
 * @author Admin
 */
@Entity
public class OrderPneu implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @OneToOne(fetch= FetchType.EAGER, targetEntity=pneuservis.backend.entities.TyreType.class)
    private TyreType tyreType;
    private int tyresCount;
    private OrderStatus status;
    @ManyToOne(fetch= FetchType.EAGER, targetEntity=pneuservis.backend.entities.Customer.class)
    private Customer customer;
    private String vehicleBrand;
    @OneToMany(fetch= FetchType.EAGER, targetEntity=pneuservis.backend.entities.ServicePneu.class)
    private List<ServicePneu> servicePneus = new ArrayList<ServicePneu>();
    
    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public TyreType getTyreType() {
        return tyreType;
    }

    public void setTyreType(TyreType tyreType) {
        this.tyreType = tyreType;
    }

    public int getTyresCount() {
        return tyresCount;
    }

    public void setTyresCount(int tyresCount) {
        this.tyresCount = tyresCount;
    }

    public OrderStatus getStatus() {
        return status;
    }

    public void setStatus(OrderStatus status) {
        this.status = status;
    }

    public Customer getCustomer() {
        return customer;
    }

    public void setCustomer(Customer customer) {
        this.customer = customer;
    }

    public String getVehicleBrand() {
        return vehicleBrand;
    }

    public void setVehicleBrand(String vehicleBrand) {
        this.vehicleBrand = vehicleBrand;
    }

    public List<ServicePneu> getServicePneus() {
        return servicePneus;
    }

    public void setServicePneus(List<ServicePneu> servicePneus) {
        this.servicePneus = servicePneus;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        
        if (!(object instanceof OrderPneu)) {
            return false;
        }
        OrderPneu other = (OrderPneu) object;
        if (this.id != null && !this.id.equals(other.id)) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "OrderPneu[ id=" + id + " ]";
    }
    
}
